<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="../comunes/header.jsp" />
<h2>Listado Flujos de Aprobaci&oacute;n</h2>
<button type="button" class="btn_agregar" title="Agregar" 
        onclick="window.location.href = '<c:url value="/flujos?form"/>'">Crear un Flujo</button>
<table class="tbl_listado">
   <thead><tr><th>Clave</th><th>Descripci&oacute;n</th><th>Desc. Corta</th>
         <th>Valida Monto</th><th>Comentarios</th><th>Estatus</th><th># Pasos</th>
         <th>Opc.</th></tr></thead>
   <tbody>
      <c:forEach var="flujo" items="${flujos}">
         <c:url var="editUrl" value="/flujos?cf=${flujo.clave}" />
         <c:url var="valiUrl" value="/flujos/valido?cf=${flujo.clave}" />
         <tr>
            <td><c:out value="${flujo.clave}"/></td>
            <td><c:out value="${flujo.descripcion}"/></td>
            <td><c:out value="${flujo.descripcionCorta}"/></td>
            <td>
               <c:choose>
                  <c:when test="${flujo.validaMonto=='S'}">Si</c:when>
                  <c:otherwise>No</c:otherwise>
               </c:choose>
            </td>
            <td><c:out value="${flujo.comentarios}"/></td>
            <td>
               <c:choose>
                  <c:when test="${flujo.estatus=='A'}">ACTIVO</c:when>
                  <c:when test="${flujo.estatus=='I'}">INACTIVO</c:when>
                  <c:otherwise>NO VALIDO</c:otherwise>
               </c:choose>
            </td>
            <td><a href="<c:url value="/flujos/pasos?cf=${flujo.clave}"/>">
                  ${flujo.pasos.size()} Pasos</a>
            </td>
            <td>
               <button type="button" class="btn_editar" onclick="window.location.href = '${editUrl}'"
                       title="Editar ${flujo.clave}">Editar</button>
               <button type="button" class="btn_copiar"
                       title="Copiar ${flujo.clave}">Copiar Flujo</button>
               <button type="button" class="btn_validar" onclick="window.location.href = '${valiUrl}'"
                       title="Validar ${flujo.clave}">Validar</button>
               <button type="button" class="btn_inactivar"
                       title="Inactivar ${flujo.clave}">Inactivar</button>
            </td>
         </tr>
      </c:forEach>
   </tbody>
</table>
<script type="text/javascript">
   $(document).ready(function() {
      $(".btn_validar").button({
         icons: {primary: "ui-icon-check"},
         text: false
      });
   });
</script>
<jsp:include page="../comunes/footer.jsp" />